package com.witmore.skyline.web.service;

import com.witmore.skyline.db.entity.DeviceDO;
import com.witmore.skyline.web.controller.vo.param.DeviceBindDriverParam;
import com.witmore.skyline.web.controller.vo.param.DeviceEditParam;
import com.witmore.skyline.web.controller.vo.param.DeviceListParamVO;
import com.witmore.skyline.web.controller.vo.param.DeviceReportParam;
import com.witmore.skyline.web.controller.vo.param.DeviceSnParam;
import com.witmore.skyline.web.controller.vo.result.*;
import com.witmore.skyline.web.service.third.yjx.dto.CloudmDeviceDTO;
import com.witmore.skyline.web.service.third.yjx.dto.DeviceLocusDTO;

import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * Description: DeviceService
 * Author: 豆子高
 * Date: 2025/2/25 10:12
 */
public interface DeviceService {
    /**
     * 从云机械拉取并保存设备列表信息
     */
    void getAndSaveDeviceListFromCloudm();

    /**
     * 从云机械拉取并保存设备信息
     */
    void deviceFieldMaintenanceFromCloudm(String deviceSn);

    void updateDevice(DeviceDO deviceDO, CloudmDeviceDTO cloudmDeviceDTO);

    /**
     * 从云机械拉取并保存设备日报相关信息
     */
    void deviceDailyFromCloudm(LocalDate startDay, LocalDate endDay,Integer skylineDeviceId);

    /**
     * 获取经纬度信息
     */
    ResponseResult<List<DeviceLocusDTO>> locusList(@NotNull(message = "设备编号不能为空") String deviceSn, LocalDate startDay, LocalDate endDay);

    /**
     * 获取设备列表 分页
     */
    ResponsePageResult<DeviceListResultVO> deviceListPage(DeviceListParamVO deviceListParamVO);


    /**
     * 从云机械拉取并保存设备当天工时
     */
    void deviceTodayWorkTimeFromCloudm();

    /**
     * 设备当天工时字段置空
     */
    void deviceTodayWorkTimeReset();

    /**
     * 获取设备类别分布
     */
    ResponseResult<List<DeviceCategoryVO>> deviceCategoryDistribution(AccountSession accountSession);


    /**
     * 获取设备日报分页
     */
    ResponsePageResult<DeviceDailyResultVO> deviceDailyReportPage(DeviceReportParam deviceDailyParamVO);

    /**
     * 设备编辑
     */
    ResponseResult<Void> edit(AccountSession accountInfo, DeviceEditParam deviceEditParam);

    void saveDeviceList(List<CloudmDeviceDTO> devices);

    Map<String, Integer> cameraPicFix(String cameraSn);

    /**
     * 获取设备地图统计信息
     */
    ResponseResult<List<DeviceMapStatisticsVO>> deviceMapStatistics(AccountSession accountSession);

    /**
     * 获取设备概况信息
     */
    ResponseResult<DeviceDetailResultVO> deviceDetail(DeviceSnParam deviceSnParam, AccountSession accountSession);

    /**
     * 查询所有设备当月使用率
     * @param accountSession 账户会话信息
     * @param category 设备类型（可选）
     * @return 设备当月使用率列表
     */
    ResponseResult<List<DeviceMonthlyUsageRateVO>> deviceMonthlyUsageRate(AccountSession accountSession, String category);

    /**
     * 绑定设备和驾驶员
     */
    ResponseResult<Void> bindDriver(DeviceBindDriverParam param, AccountSession accountSession);

    /**
     * 解绑设备和驾驶员
     */
    ResponseResult<Void> unbindDriver(Integer deviceId, AccountSession accountSession);

    /**
     * 查询设备绑定的驾驶员详情
     */
    ResponseResult<DriverSimpleVO> getDriverByDevice(Integer deviceId);

}
